package com.ocp.macro.controller;

import com.ocp.macro.service.DealerAccountService;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 该controller用于请求那些无序身份认证和权限认证的请求
 */
@CrossOrigin
@RestController
public class CommController {
    @Resource
    private DealerAccountService dealerAccountService;

    /**
     * 请求该账号是否在数据库存在
     * @param username 要进行登录的账号
     * @param loginType 账号登录方式
     */
    @GetMapping("/macro/comm/accountexists")
    public String accountExists(@RequestParam("userName") String username,
                                @RequestParam("loginType") String loginType){
        return dealerAccountService.accountUsernameExists(username,loginType);
    }

    @GetMapping("/macro/user/info")
    public String loginInfo(){
        return dealerAccountService.getLoginUserInfo(null);
    }

}
